package org.act.xservices.rt.xcontainer.message.worker;

import org.act.xservices.rt.xcontainer.framework.IConnector;
import org.act.xservices.rt.xcontainer.framework.dispatcher.ADispatchWorkerFactory;
import org.act.xservices.rt.xcontainer.framework.dispatcher.ISafeDispatchWorker;
import org.act.xservices.rt.xcontainer.inf.context.IATFTransportContext;
import org.act.xservices.rt.xcontainer.message.handler.MessageSerializeHandler;


/**
 * @LastModifyTime 2008-7-7
 * @CreationTime 2007-5-24
 * @author Lizq [lizq@act.buaa.edu.cn]
 * @since JDK1.5
 */
public class MessageInWorkerFactory extends ADispatchWorkerFactory<IATFTransportContext> {

	private MessageSerializeHandler transportPoolHandler;

	public MessageInWorkerFactory(IConnector connector) {
		super(connector);
	}


	@SuppressWarnings("unchecked")
	@Override
	public final ISafeDispatchWorker createSafeDispatchWorker(IATFTransportContext x) {
		
		MessageInWorker messageInWorker = new MessageInWorker(this.getConnector());
		
		messageInWorker.setTransportContext(x);
		messageInWorker.setTransportPoolHandler(transportPoolHandler);
		return messageInWorker;
	}

	public MessageSerializeHandler getTransportPoolHandler() {

		return transportPoolHandler;
	}

	public void setTransportPoolHandler(
			MessageSerializeHandler transportPoolHandler) {

		this.transportPoolHandler = transportPoolHandler;
	}

}
